@echo off
echo ========================================
echo 测试CSV导入功能
echo Testing CSV Import
echo ========================================
echo.

echo 准备CSV测试数据...
set csvData=E1001,2025-10-25 09:00:00,IN,DEVICE,正常打卡^
E1001,2025-10-25 18:00:00,OUT,DEVICE,正常打卡^
E1002,2025-10-25 09:05:00,IN,DEVICE,正常打卡^
E1002,2025-10-25 18:10:00,OUT,DEVICE,正常打卡

echo.
echo 测试CSV导入 POST /api/clock-records/import
powershell -Command "$body = @{ csvData='E1001,2025-10-25 09:00:00,IN,DEVICE,正常打卡`nE1001,2025-10-25 18:00:00,OUT,DEVICE,正常打卡`nE1002,2025-10-25 09:05:00,IN,DEVICE,正常打卡`nE1002,2025-10-25 18:10:00,OUT,DEVICE,正常打卡' } | ConvertTo-Json; try { $response = Invoke-RestMethod -Uri 'http://localhost:8080/api/clock-records/import' -Method Post -Body $body -ContentType 'application/json'; Write-Host '导入成功!' -ForegroundColor Green; Write-Host '成功导入记录数:' $response.count; $response | Format-List } catch { Write-Host '导入失败' -ForegroundColor Red; Write-Host $_.Exception.Message }"

echo.
echo 验证导入结果 GET /api/clock-records
powershell -Command "$response = Invoke-RestMethod -Uri 'http://localhost:8080/api/clock-records?from=2025-10-25&to=2025-10-25' -Method Get; Write-Host '10月25日的打卡记录数:' $response.total -ForegroundColor Cyan"

echo.
echo ========================================
echo 测试完成！
echo 访问 http://localhost:8080/clock.html
echo 点击"📁 CSV导入"按钮可手动导入CSV文件
echo ========================================
pause

